﻿
@{
    ViewData["Title"] = "库房修复记录";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section Head{
    <link href="~/layuiadmin/style/style.css" rel="stylesheet" />
}

<div id="dMain">
    <div class="wrapper-content">
        <div class="layui-card">
            <div class="layui-card-header">库房修复记录</div>
            <div class="layui-card-body">
                <table id="tabData" lay-filter="demo"></table>
            </div>
        </div>
    </div>
</div>

<script>
    window.onload = function () {
        layui.use('table', function () {
            var table = layui.table;

            table.render({
                elem: '#tabData',
                toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
                page: true,
                height: 'full-80',
                limit: 30,
                limits: [30, 40, 50],
                loading: true,
                cols: [
                    [ //表头
                        {
                            title: '#',
                            type: 'checkbox'
                        }, {
                            field: 'Department',
                            title: '所属部门',
                            width: 150,
                            sort: true,
                            align: "center"
                        }, {
                            field: 'Restorer',
                            title: '修复人 ',
                            width: 100,
                            sort: true,
                            align: "center"
                        }, {
                            field: 'Repairtime',
                            title: '修复时间',
                            width: 130,
                            sort: true,
                            align: "center"
                        }, {
                            field: 'RepairContent',
                            title: '修复内容',
                            align: "center"
                        }, {
                            field: 'RepairResult',
                            title: '修复结果',
                            align: "center"
                        }, {
                            field: 'remark',
                            title: '备注',
                            width: 80,
                            align: "center"
                        }, {
                            field: 'Operation',
                            title: '操作',
                            templet: barDemo,
                            align: "center",
                            width: 100
                        }
                    ]
                ],
                data: [{
                    "Department": "2",
                    "Restorer": "4",
                    "Repairtime": "5",
                    "RepairContent": "6",
                    "RepairResult": "7",
                    "remark": "8"
                }]
            });
        })

        layui.use('table', function () {
            var table = layui.table;
            //监听工具条
            table.on('tool(demo)', function (obj) {
                var data = obj.data;
                if (obj.event === 'detail') {
                    layer.msg('ID：' + data.id + ' 的查看操作');
                } else if (obj.event === 'del') {
                    layer.confirm('确定删除此行数据？', function (index) {
                        obj.del();
                        layer.close(index);
                    });
                } else if (obj.event === 'edit') {
                    layer.alert('编辑' + JSON.stringify(data))
                }
            });
        });
    }
</script>

<script type="text/html" id="barDemo">
    <a class="text-success" lay-event="edit">编辑</a> &nbsp;
    <a class="text-danger" lay-event="del">删除</a>
</script>

<!-- 表格按钮组 -->
<script type="text/html" id="toolbarDemo">
    <div class="MenuManager-title"></div>
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="" id="RepairRecordsAdd">添加信息</button>
    </div>
    <div class="layui-inline layui-inline-secate">
        <input class="layui-input" name="id" id="test-table-demoReload" autocomplete="off" placeholder="搜索" data-type="reload">
    </div>

    <script>
        $('#RepairRecordsAdd').click(function () {
            layer.open({
                type: 2,
                title: "添加信息",
                area: ['700px', '520px'],
                fixed: false,
                content: '/Warehouse/Warehouse/RepairRecordsAdd',
                btn: ['确定', '取消']
            });
        })
    </script>

</script>
